package club.banyuan;

import java.io.*;
import java.net.Socket;

public class TcpSendRepeat {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("192.168.9.151", 5000);
        OutputStream outputStream = socket.getOutputStream();
        InputStream inputStream = socket.getInputStream();
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream));
        BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));

        for (int i = 0; i < 10; i++) {
            writer.write("伞兵" + i + "号准备战斗！");
            writer.newLine();
            writer.flush();
            String s = reader.readLine();
            System.out.println(s);
        }
        socket.close();
    }
}
